//
// Created by yewei on 2023/1/7.
//
#include <bits/stdc++.h>

using namespace std;

int main() {
    freopen("../input.txt", "r", stdin);
    int T;
    cin>>T;
    string s;
    int n;
    while(T--){
        cin>>n;
        getchar();
        getline(cin,s);
        set<int> index;
        int index1 = s.find('.');
        while(index1!=-1){
            index.insert(index1);
            index1 = s.find('.',index1+1);
        }
        int index2 = s.find('?');
        while(index2!=-1){
            index.insert(index2);
            index2 = s.find('?',index2+1);
        }
        int index3 = s.find('!');
        while(index3!=-1){
            index.insert(index3);
            index3 = s.find('!',index3+1);
        }
        int pre=-1;
        vector<int> res;
        for(int i : index) {
            res.push_back(i-pre);
            pre = i+1;
        }
        int cnt = 1;
        pre = 0;
        int flag = 0;
        for(int i=0;i<res.size();i++){
            if(res[i]>n) {
                flag = 1;
                break;
            }
            if(res[i]+pre<=n) pre += res[i];
            else {
                cnt++;
                pre = res[i];
            }
        }
        if(flag) cout<<"Impossible"<<endl;
        else cout<<cnt<<endl;
    }
}
